<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no" />
		<title></title>
	</head>
	<link href="../c/settleanchor.css" rel="stylesheet" type="text/css" />
	<body>
		<div class="main">
			<p><span>艺名</span><img src="../i/right-bai.png"><input type="text" placeholder="未填写" class="anchor_nickname"></p>
			<p><span>真实姓名</span><img src="../i/right-bai.png"><input type="text" placeholder="未填写" class="anchor_name"></p>
			<p><span>身份证号码</span><img src="../i/right-bai.png"><input type="text" placeholder="未填写" class="anchor_sf"></p>
			<p><span>常驻平台</span><img src="../i/right-bai.png"><input type="text" placeholder="未填写" class="anchor_pt"></p>
			<p><span>粉丝数</span><img src="../i/right-bai.png"><input type="text" placeholder="未填写" class="anchor_fs"></p>
			<p><span>粉丝主要区域</span><img src="../i/right-bai.png"><input type="text" placeholder="未填写" class="anchor_qy"></p>
			<p><span>常驻平台个人主页</span><img src="../i/right-bai.png"><input type="text" placeholder="未填写" class="anchor_zy"></p>
			<div class="lx">
				<small>主播类型</small>
				<span class="lx_span1 allspan">短视频</span>
				<span class="lx_span1">娱乐主播</span>
				<span class="lx_span1">带货主播</span>
				<span class="lx_span1">活动现场</span>
			</div>
			<div class="file"><span>个人照片</span>
				<span class="flis"><input type="file" class="fileinput"><small>上传</small></span>
				<img src="" class="userpic">
			</div>
			<p class="smlk"><span>代表作品</span></p>
			<input type="text" placeholder="短视频地址" class="dspaddress dsp" />
			<div class="zbaddrss"><input type="text" placeholder="直播录像地址" class="dspaddress zblx" /><span>+</span></div>
		</div>
		<button class="btn">提交审核</button>
	</body>
</html>
<script src="../j/api.js"></script>
<script src="../j/jquery-3.3.1.min.js"></script>
<script>
	//身份验证
	function isCardNo(card) {
		var pattern = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
		return pattern.test(card);
	}
	$(function() {
		//上传图片
		$(".file").on("change", ".fileinput", function() {
			var objUrl = new FileReader();
			var file = $(this).get(0).files[0];
			var rep = /jpeg|png|gif|bmp/ig;
			var gstyle = file.type.split("/")[1];
			if(rep.test(gstyle)){
				objUrl.readAsDataURL(file);
				 var that = this;
				    objUrl.onload = function(e) {
				         $(".userpic").attr("src",this.result);
						  $(".userpic").show();
				   };
			}else{
				alert("图片格式不正确，请上传 jpe`
			}
			// console.log(file.name);
			// $(".userpic").attr("src", file.name);
			// $(".userpic").show();
		})


		//提交审核
		$(".btn").on("click", function() {
			//艺名
			var nickname = $(".anchor_nickname").val();
			//真实姓名
			var username = $(".anchor_name").val();
			//身份证号码
			var carda = $(".anchor_sf").val();
			//长驻平台
			var pt = $(".anchor_pt").val();
			//粉丝数
			var fs = $(".anchor_fs").val();
			//粉丝区域
			var qy = $(".anchor_qy").val();
			//常驻平台个人主页
			var zy = $(".anchor_zy").val();
			//直播类型
			var lx = $(".allspan").text();
			//个人照片
			var userpic = $(".userpic").attr("src");
			//短视频地址
			var dsp = $(".dsp").val();
			//直播录像地址
			var dsp = $(".zblx").val();
			if (nickname == "" || nickname == null) {
				_alert("请填写艺名");
				$(".anchor_nickname").focus();       
				return;
			} else if (username == "" || username == null) {
				_alert("请填写真实名字");
				$(".anchor_name").focus();
				return;
			} else if (carda.length == 0) {
				_alert("请填写身份证号码");
				$(".anchor_sf").focus();
				return; 
			} else if (isCardNo(carda) == false) {
				_alert("身份证号码填写错误");
				$(".anchor_sf").focus();
				return;
			} else if (userpic == "" || userpic == undefined) {
				_alert("请上传个人照片");
				return;
			}


		})


	})
</script>
